<template>
    <div class="dialog" v-show="showMask" @click.stop="closeMask">
        <div class="dialog-container" @click.stop>
            <div class="dialog-title">设备详情</div>
            <div class="content">
              <table border="1" width="100%;" cellpadding="10" class="tablescrool" bordercolor="#375753">
                <tr>
                  <th align="left">点位名称</th>
                  <th>品牌</th>
                  <th>设备状态</th>
                  <th>维护人</th>
                  <th align="left">地址</th>
                </tr>
                <tr v-for="(item,index) in dataitem" :key="index">
                  <td>{{item.monitorName}}</td>
                  <td align="center">{{item.brandName}}</td>
                  <td align="center">{{item.deviceStatus}}</td>
                  <td align="center">{{item.managerName}}</td>
                  <td>{{item.address}}</td>
                </tr>
              </table>

            </div>
            <!-- <div class="btns">
                <div v-if="type != 'confirm'" class="default-btn" @click="closeBtn">
                    {{cancelText}}
                </div>
                <div v-if="type == 'danger'" class="danger-btn" @click="dangerBtn">
                    {{dangerText}}
                </div>
                <div v-if="type == 'confirm'" class="confirm-btn" @click="confirmBtn">
                    {{confirmText}}
                </div>
            </div> -->
            <div class="close-btn" @click.stop="closeMask"><img src="../assets/imgs/clos.png"></div>
        </div>
        
    </div>
</template>
<script>
  import axios from 'axios'
export default {
    props: {
        value: {},
        // 类型包括 defalut 默认， danger 危险， confirm 确认，
        type:{
            type: String,
            default: 'default'
        },
        dataid:{
            type: String,
            default: ''
        },
        content: {
            type: String,
            default: ''
        },
        title: {
            type: String,
            default: ''
        },
        cancelText: {
            type: String,
            default: '取消'
        },
        dangerText: {
            type: String,
            default: '删除'
        },
        confirmText: {
            type: String,
            default: '确认'
        },
        dataitem:[]
    },
    data(){
        return{
            showMask: false,
        }
    },
    methods:{
        closeMask(){
            this.showMask = false;
            this.dataid = '';
        },
        closeBtn(){
            this.$emit('cancel');
            this.closeMask();
        },
        dangerBtn(){
            this.$emit('danger');
            this.closeMask();
        },
        confirmBtn(){
            this.$emit('confirm');
            this.closeMask();
        },
        canteenInfo(id){
          axios.get(`/api/web/pub/canteenInfo/info/${id}`).then(response => {
                console.log(response.data.rows)
                this.dataitem = response.data.rows;
            }
            
            ).catch(error => 
            console.log(error)
        )
        }
         
    },
    mounted(){
        this.showMask = this.value;
        
    },
    created(){

    },
    watch:{
        value(newVal, oldVal){
            this.showMask = newVal;
            this.canteenInfo(this.dataid);
        },
        showMask(val) {
            this.$emit('input', val);
        },
        dataid:function(){
          this.canteenInfo(this.dataid);
        }
    },
}
</script>
<style lang="less" scoped>
    .dialog{
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9999;
        .dialog-container{
            /*width: 500px;
            height: 380px;*/
            width: 1060px;
height: 489px;
overflow: scroll;
            background: #ffffff;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            border-radius: 8px;
            position: relative;
            background: #052D27;
border-radius: 12px;
border: 3px solid;
border-image: linear-gradient(270deg, rgba(0, 252, 255, 0.1), rgba(0, 252, 255, 1), rgba(0, 252, 255, 0.1)) 3 3;
            .dialog-title{
                width: 100%;
                height: 60px;
                font-size: 18px;
                /*color: #696969;*/
                color: #0CFED9;
                font-weight: 600;
                padding: 16px 50px 0 20px;
                box-sizing: border-box;
                border-bottom: 1px solid #375752;
            }
            .content{
              font-size: 14px;
              width: 100%;
                color: #797979;
                line-height: 26px;
                padding: 40px 20px;
                box-sizing: border-box;
            }
            .inp{
                margin: 10px 0 0 20px;
                width: 200px;
                height: 40px;
                padding-left: 4px;
                border-radius: 4px;
                border: none;
                background: #efefef;
                outline: none;
                &:focus{
                    border: 1px solid #509EE3;
                }
            }
            .btns{
                width: 100%;
                height: 60px;
                // line-height: 60px;
                position: absolute;
                bottom: 0;
                left: 0;
                text-align: right;
                padding: 0 16px;
                box-sizing: border-box;
                & > div{
                    display: inline-block;
                    height: 40px;
                    line-height: 40px;
                    padding: 0 14px;
                    color: #ffffff;
                    background: #f1f1f1;
                    border-radius: 8px;
                    margin-right: 12px;
                    cursor: pointer;
                }
                .default-btn{
                    color: #787878;
                    &:hover{
                        color: #509EE3; 
                    }
                }
                .danger-btn{
                    background: #EF8C8C;
                    &:hover{
                        background: rgb(224, 135, 135);
                    }
                    &:active{
                        background: #EF8C8C;
                    }
                }
                .confirm-btn{
                    color: #ffffff;
                    background: #509EE3;
                    &:hover{
                        background: #6FB0EB;
                    }
                }
            }
            .close-btn{
                position: absolute;
                top: 16px;
                right: 16px;
                width: 30px;
                height: 30px;
                line-height: 30px;
                text-align: center;
                font-size: 18px;
                cursor: pointer;
                &:hover{
                    font-weight: 600;
                }
            }
        }
    }
    .close-btn img{
      width: 24px;
      height: 24px;
    }
    table {
border-collapse:collapse;

}
.dialog-container::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}

.dialog-container {
  scrollbar-width: none; /* firefox */
  -ms-overflow-style: none; /* IE 10+ */
  overflow-x: hidden;
  overflow-y: auto;
}
</style>
